package com.liyujie.serialport.utils;

import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;

import com.liyujie.serialport.receiver.CH340USBSK;


public class USBAuthorizationUtils {
    public static final  String INTENT_ACTION_GRANT_USB = "com.hoho.android.usbserial.examples.GRANT_USB";

    /**
     * 授权USB权限
     */
    public static void Authorization(Context mContext){
        if(null != CH340USBSK.manager && null != CH340USBSK.usbSerialDriver){
            PendingIntent usbPermissionIntent = PendingIntent.getBroadcast(mContext, 0, new Intent(INTENT_ACTION_GRANT_USB), 0);
            CH340USBSK.manager.requestPermission(CH340USBSK.usbSerialDriver.getDevice(), usbPermissionIntent);
            TextToSpeechUtils.播放文字转语言的方法("请勾选USB权限");
        }
    }
}
